package com.cskaoyan;

import com.cskaoyan.config.ShiroProperties;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.util.Arrays;
import java.util.LinkedHashMap;

@SpringBootApplication
@MapperScan("com.cskaoyan.mapper")
@EnableTransactionManagement
public class MallApplication {
    @Autowired
    static ShiroProperties shiroProperties;

    public static void main(String[] args) {
        SpringApplication.run(MallApplication.class, args);
    }

    // @Bean
    // public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
    //     return args -> {
    //
    //         System.out.println("Let's inspect the beans provided by Spring Boot:");
    //
    //         ShiroProperties shiroProperties = (ShiroProperties) ctx.getBean("shiroProperties");
    //         LinkedHashMap<String, String> filterChainDefinitionMap = shiroProperties.getFilterChainDefinitionMap();
    //         String[] beanNames = ctx.getBeanDefinitionNames();
    //         Arrays.sort(beanNames);
    //         for (String beanName : beanNames) {
    //             System.out.println(beanName);
    //         }
    //
    //     };
    // }
}
